package com.js.demo07;

import javafx.application.Application;
import javafx.scene.Cursor;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

import java.net.URL;
import java.util.Enumeration;

public class Demo extends Application
{

    private Button button;

//    第3课初步认识stage窗口
    @Override
    public void start(Stage stage) throws Exception {

        button = new Button("按钮");
        button.setPrefWidth(200);
        button.setPrefHeight(200);

        stage.setTitle("Hello World");
        stage.setWidth(500);
        stage.setHeight(300);

        Group group = new Group();
        Scene scene = new Scene(group);
        stage.setScene(scene);

        URL resources = getClass().getResource("/icon/icon.png");
//        设置光标
        System.out.println("resources: " + resources.toExternalForm());
        scene.setCursor(Cursor.cursor(resources.toExternalForm()));

        group.getChildren().add(button);

        stage.show();
    }

    @Override
    public void init() throws Exception {
        super.init();
        System.out.println("init");
    }

    @Override
    public void stop() throws Exception {
        super.stop();
        System.out.println("stop");
    }
}
